Skip to content

feat: add uninit command to reverse init changes#37

Merged
piotrski merged 2 commits intocallstackincubator:mainfrom
kacper-mikolajczak:feat/uninit-command
Apr 3, 2026
Merged

feat: add uninit command to reverse init changes#37
piotrski merged 2 commits intocallstackincubator:mainfrom
kacper-mikolajczak:feat/uninit-command

Conversation

@kacper-mikolajczak
Copy link
Copy Markdown
Contributor

Summary

Adds agent-react-devtools uninit [--dry-run] command that cleanly reverses all changes made by init.

Problem

init patches framework entry files/configs but there's no way to undo those changes programmatically. Users have to manually find and remove the added imports/plugins, or use git checkout. This is friction for workflows where devtools integration is temporary (e.g. profiling sessions).

What this does

  • Adds uninit command to CLI
  • Removes imports/plugins for all supported frameworks:
    • Vite: removes import and reactDevtools() call from config
    • Next.js App Router: deletes devtools.ts wrapper, removes import from layout
    • Next.js Pages Router: removes import from _app
    • CRA: removes import from entry file
  • Supports --dry-run to preview changes
  • No-ops gracefully when not configured

Tests

7 new tests covering all frameworks, dry-run, no-op, and init/uninit/init roundtrip. All 75 tests pass.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 6, 2026

🦋 Changeset detected

Latest commit: 5087dda

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agent-react-devtools Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kacper-mikolajczak kacper-mikolajczak marked this pull request as ready for review March 6, 2026 14:26
Copy link
Copy Markdown
Collaborator

@piotrski piotrski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! The structure and test coverage are solid, the roundtrip test especially is a good correctness gate.

@piotrski piotrski dismissed their stale review April 2, 2026 22:28

Fixing the issues directly

kacper-mikolajczak and others added 2 commits April 3, 2026 07:08
Add `agent-react-devtools uninit` command that removes all configuration
added by `init`. Supports all frameworks (Vite, Next.js App/Pages Router,
CRA) and includes --dry-run flag.

This makes it easy to cleanly remove devtools integration without
manually tracking which files were modified.
…n ownership

- removeImport now matches the exact import string instead of any line
  containing 'agent-react-devtools', preventing accidental removal of
  unrelated comments or imports
- unpatchViteConfig filters the exact import line inserted by init
- unpatchNextJs only removes the layout's import './devtools' when
  devtools.ts was confirmed to be ours, preventing corruption of
  pre-existing imports with the same name
- Add changeset and README entry for uninit command
@piotrski piotrski force-pushed the feat/uninit-command branch from 30f78cc to 5087dda Compare April 3, 2026 05:09
@piotrski piotrski merged commit c7127db into callstackincubator:main Apr 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants